package entity_controllers.options;

import misc.MArrayList;
import core.subcontrollers.SubController;
import ie.FieldBoard;
import ie.PlayerBoard;
import ie.Shaker;
import dto.Player;
import entity.Account;
import entity.fields.properties.Street;
import entity_controllers.Option;

public class SellHouseOption extends Option {

	public SellHouseOption(String title) {
		super(title);
	}

	@Override
	public void execute(Player player, FieldBoard gameBoard, PlayerBoard playerList, Shaker shaker) {
		if (((Account) player.getAccount()).hasBuildings())
			SubController.sellHouse(player);
		if (SubController.streetConstruction(player, gameBoard, new MArrayList<Street>()))
			((Account) player.getAccount()).getOM().getOption(BuyHouseOption.class).enable();
		if (((Account) player.getAccount()).hasBuildings())
			this.enable();
	}

	@Override
	public void reset() {
		// TODO Auto-generated method stub

	}

}
